/*
 * Copyright 2011 Sina.
 *
 * Licensed under the Apache License and Weibo License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.open.weibo.com
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package weibo.sdk.com.weibo.net;


/**
 * Encapsulation a Weibo error, when weibo request can not be implemented successful.
 *
 * @author  ZhangJie (zhangjie2@staff.sina.com.cn)
 */
public class WeiboException extends Exception {

	private static final long serialVersionUID = 475022994858770424L;
	
	
	/*304 Not Modified: 娌℃湁鏁版嵁杩斿洖.
	400 Bad Request: 璇锋眰鏁版嵁涓嶅悎娉曪紝鎴栬�瓒呰繃璇锋眰棰戠巼闄愬埗. 璇︾粏鐨勯敊璇唬鐮佸涓嬶細
	40028:鍐呴儴鎺ュ彛閿欒(濡傛灉鏈夎缁嗙殑閿欒淇℃伅锛屼細缁欏嚭鏇翠负璇︾粏鐨勯敊璇彁绀�
	40033:source_user鎴栬�target_user鐢ㄦ埛涓嶅瓨鍦�
	40031:璋冪敤鐨勫井鍗氫笉瀛樺湪
	40036:璋冪敤鐨勫井鍗氫笉鏄綋鍓嶇敤鎴峰彂甯冪殑寰崥
	40034:涓嶈兘杞彂鑷繁鐨勫井鍗�
	40038:涓嶅悎娉曠殑寰崥
	40037:涓嶅悎娉曠殑璇勮
	40015:璇ユ潯璇勮涓嶆槸褰撳墠鐧诲綍鐢ㄦ埛鍙戝竷鐨勮瘎璁�
	40017:涓嶈兘缁欎笉鏄綘绮変笣鐨勪汉鍙戠淇�
	40019:涓嶅悎娉曠殑绉佷俊
	40021:涓嶆槸灞炰簬浣犵殑绉佷俊
	40022:source鍙傛暟(appkey)缂哄け
	40007:鏍煎紡涓嶆敮鎸侊紝浠呬粎鏀寔XML鎴朖SON鏍煎紡
	40009:鍥剧墖閿欒锛岃纭繚浣跨敤multipart涓婁紶浜嗗浘鐗�
	40011:绉佷俊鍙戝竷瓒呰繃涓婇檺
	40012:鍐呭涓虹┖
	40016:寰崥id涓虹┖
	40018:ids鍙傛暟涓虹┖
	40020:璇勮ID涓虹┖
	40023:鐢ㄦ埛涓嶅瓨鍦�
	40024:ids杩囧锛岃鍙傝�API鏂囨。
	40025:涓嶈兘鍙戝竷鐩稿悓鐨勫井鍗�
	40026:璇蜂紶閫掓纭殑鐩爣鐢ㄦ埛uid鎴栬�screen name
	40045:涓嶆敮鎸佺殑鍥剧墖绫诲瀷,鏀寔鐨勫浘鐗囩被鍨嬫湁JPG,GIF,PNG
	40008:鍥剧墖澶у皬閿欒锛屼笂浼犵殑鍥剧墖澶у皬涓婇檺涓�M
	40001:鍙傛暟閿欒锛岃鍙傝�API鏂囨。
	40002:涓嶆槸瀵硅薄鎵�睘鑰咃紝娌℃湁鎿嶄綔鏉冮檺
	40010:绉佷俊涓嶅瓨鍦�
	40013:寰崥澶暱锛岃纭涓嶈秴杩�40涓瓧绗�
	40039:鍦扮悊淇℃伅杈撳叆閿欒
	40040:IP闄愬埗锛屼笉鑳借姹傝璧勬簮
	40041:uid鍙傛暟涓虹┖
	40042:token鍙傛暟涓虹┖
	40043:domain鍙傛暟閿欒
	40044:appkey鍙傛暟缂哄け
	40029:verifier閿欒
	40027:鏍囩鍙傛暟涓虹┖
	40032:鍒楄〃鍚嶅お闀匡紝璇风‘淇濊緭鍏ョ殑鏂囨湰涓嶈秴杩�0涓瓧绗�
	40030:鍒楄〃鎻忚堪澶暱锛岃纭繚杈撳叆鐨勬枃鏈笉瓒呰繃70涓瓧绗�
	40035:鍒楄〃涓嶅瓨鍦�
	40053:鏉冮檺涓嶈冻锛屽彧鏈夊垱寤鸿�鏈夌浉鍏虫潈闄�
	40054:鍙傛暟閿欒锛岃鍙傝�API鏂囨。
	40059: 鎻掑叆澶辫触锛岃褰曞凡瀛樺湪
	40060锛氭暟鎹簱閿欒锛岃鑱旂郴绯荤粺绠＄悊鍛�
	40061锛氬垪琛ㄥ悕鍐茬獊
	40062锛歩d鍒楄〃澶暱浜�
	40063锛歶rls鏄┖鐨�
	40064锛歶rls澶浜�
	40065锛歩p鏄┖鍊�
	40066锛歶rl鏄┖鍊�
	40067锛歵rend_name鏄┖鍊�
	40068锛歵rend_id鏄┖鍊�
	40069锛歶serid鏄┖鍊�
	40070锛氱涓夋柟搴旂敤璁块棶api鎺ュ彛鏉冮檺鍙楅檺鍒�
	40071锛氬叧绯婚敊璇紝user_id蹇呴』鏄綘鍏虫敞鐨勭敤鎴�
	40072锛氭巿鏉冨叧绯诲凡缁忚鍒犻櫎
	40073锛氱洰鍓嶄笉鏀寔绉佹湁鍒嗙粍
	40074锛氬垱寤簂ist澶辫触
	40075锛氶渶瑕佺郴缁熺鐞嗗憳鐨勬潈闄�
	40076锛氬惈鏈夐潪娉曡瘝
	40084锛氭彁閱掑け璐ワ紝闇�鏉冮檺
	40082锛氭棤鏁堝垎绫�
	40083锛氭棤鏁堢姸鎬佺爜
	40084锛氱洰鍓嶅彧鏀寔绉佹湁鍒嗙粍
	401 Not Authorized: 娌℃湁杩涜韬唤楠岃瘉.
	40101 version_rejected Oauth鐗堟湰鍙烽敊璇�
	40102 parameter_absent Oauth缂哄皯蹇呰鐨勫弬鏁�
	40103 parameter_rejected Oauth鍙傛暟琚嫆缁�
	40104 timestamp_refused Oauth鏃堕棿鎴充笉姝ｇ‘
	40105 nonce_used Oauth nonce鍙傛暟宸茬粡琚娇鐢�
	40106 signature_method_rejected Oauth绛惧悕绠楁硶涓嶆敮鎸�
	40107 signature_invalid Oauth绛惧悕鍊间笉鍚堟硶
	40108 consumer_key_unknown! Oauth consumer_key涓嶅瓨鍦�
	40109 consumer_key_refused! Oauth consumer_key涓嶅悎娉�
	40110 token_used! Oauth Token宸茬粡琚娇鐢�
	40111 Oauth Error: token_expired! Oauth Token宸茬粡杩囨湡
	40112 token_revoked! Oauth Token涓嶅悎娉�
	40113 token_rejected! Oauth Token涓嶅悎娉�
	40114 verifier_fail! Oauth Pin鐮佽璇佸け璐�
	402 Not Start mblog: 娌℃湁寮��寰崥
	403 Forbidden: 娌℃湁鏉冮檺璁块棶瀵瑰簲鐨勮祫婧�
	40301 too many lists, see doc for more info 宸叉嫢鏈夊垪琛ㄤ笂闄�
	40302 auth faild 璁よ瘉澶辫触
	40303 already followed 宸茬粡鍏虫敞姝ょ敤鎴�
	40304 Social graph updates out of rate limit 鍙戝竷寰崥瓒呰繃涓婇檺
	40305 update comment out of rate 鍙戝竷璇勮瓒呰繃涓婇檺
	40306 Username and pwd auth out of rate limit 鐢ㄦ埛鍚嶅瘑鐮佽璇佽秴杩囪姹傞檺鍒�
	40307 HTTP METHOD is not suported for this request 璇锋眰鐨凥TTP METHOD涓嶆敮鎸�
	40308 Update weibo out of rate limit 鍙戝竷寰崥瓒呰繃涓婇檺
	40309 password error 瀵嗙爜涓嶆纭�
	40314 permission denied! Need a high level appkey 璇ヨ祫婧愰渶瑕乤ppkey鎷ユ湁鏇撮珮绾х殑鎺堟潈
	404 Not Found: 璇锋眰鐨勮祫婧愪笉瀛樺湪.
	500 Internal Server Error: 鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�
	502 Bad Gateway: 寰崥鎺ュ彛API鍏抽棴鎴栨鍦ㄥ崌绾�.
	503 Service Unavailable: 鏈嶅姟绔祫婧愪笉鍙敤.*/
	private int statusCode = -1;
	
	
	
    public WeiboException(String msg) {
        super(msg);
    }

    public WeiboException(Exception cause) {
        super(cause);
    }

    public WeiboException(String msg, int statusCode) {
        super(msg);
        this.statusCode = statusCode;
    }

    public WeiboException(String msg, Exception cause) {
        super(msg, cause);
    }

    public WeiboException(String msg, Exception cause, int statusCode) {
        super(msg, cause);
        this.statusCode = statusCode;
    }

    public int getStatusCode() {
        return this.statusCode;
    }
    
    
	public WeiboException() {
		super(); 
	}

	public WeiboException(String detailMessage, Throwable throwable) {
		super(detailMessage, throwable);
	}

	public WeiboException(Throwable throwable) {
		super(throwable);
	}

	public WeiboException(int statusCode) {
		super();
		this.statusCode = statusCode;
	}

	public void setStatusCode(int statusCode) {
		this.statusCode = statusCode;
	}
	
}
